package org.ghost.akka.client.demo;

import org.ghost.akka.client.AkkaClientProxy;
import org.ghost.akka.common.command.StartCommand;
import org.ghost.akka.common.em.TaskTypeEnum;
import org.ghost.akka.common.model.TaskJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.UUID;

public class ClientRunner {

    private final static Logger logger = LoggerFactory.getLogger(ClientRunner.class);

    public static void main(String[] args) {
        TaskJob job = new TaskJob(UUID.randomUUID().toString(), TaskTypeEnum.TEST);
        AkkaClientProxy.getInstance().doProcess(new StartCommand(job));

        try {
            synchronized (job) {
                job.wait();
            }
        } catch (InterruptedException e) {
            logger.error("start job error", e);
        }

        logger.info("process result:" + job.getResponse());
    }
}
